﻿using System.IO;
using ApprovalTests;
using ApprovalTests.Reporters;
using License;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Registration.Test.TestUtils;

namespace Registration.Test
{
    [TestClass]
    [UseReporter(typeof (DiffReporter))]
    public class DriverLicenseTest
    {
        [TestMethod]
        public void TestHeight()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Dan", "Gilkerson");
            license.Show();
            license.Close();
            Assert.AreEqual("2 m", license.HeightLabel.Text);
        }
        
        [TestMethod]
        public void TestName()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Catherine", "Powell");
            Assert.AreEqual("Catherine Powell", license.Person.FullName);
        }

        [TestMethod]
        public void TestNameDisplay()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Catherine", "Powell");
            Assert.AreEqual("Segoe UI", license.NameLabel.FontFamily.ToString());
        }

        [TestMethod]
        public void TestRedId()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Woody", "Zuill");
            Assert.AreEqual("#FFFF2F2F", license.IdLabel.Foreground.ToString());
        }

        [TestMethod]
        public void TestPictureSize()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Woody", "Zuill");
            Assert.AreEqual(193, license.PhotoImage.Height, 0.5);
            Assert.AreEqual(144, license.PhotoImage.Width, 0.5);
        }

        [TestMethod]
        public void TestWeight()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Lynn", "Langit");
            Assert.AreEqual(63, license.Person.Weight);
        }

        [TestMethod]
        public void TestWeightDisplay()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Lynn", "Langit");
            license.Show();
            license.Close();
            Assert.AreEqual("63 kg", license.WeightLabel.Text);
        }

        [TestMethod]
        public void TestGender()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Lynn", "Langit");
            Assert.AreEqual("Female", license.Person.Gender);
        }

        

        [TestMethod]
        public void TestHeightHeight()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Dan", "Gilkerson");
            Assert.AreEqual(12, license.HeightLabel.FontSize);
        }
        [TestMethod]
        public void TestOverlay()
        {
            Initalize();
            var license = new DriversLicense();
            license.Load("Dan", "Gilkerson");

            Assert.AreEqual("#FFDED6D6", license.OverlayLabel.Foreground.ToString());
        }

        private void Initalize()
        {
            DatabaseUtils.InitializeDatabase();
        }
    }
}